import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App'
import Home from './components/Home'
import Newest from './components/Newest'
import Top from './components/Top'
import Rules from './components/Rules'
import Preview from './components/Preview'

import AssetsManager from './libs/AssetsManager'
import WanbaClientRuntime from './app/WanbaClientRuntime'

Vue.use(WanbaClientRuntime)
Vue.use(AssetsManager)
Vue.use(VueRouter)

var router = new VueRouter()

router.map({
  '/home': {
    name: 'home',
    component: Home,
    subRoutes: {
      '/newest': {
        name: 'newest',
        component: Newest
      },
      '/top': {
        name: 'top',
        component: Top
      },
      '/rules': {
        name: 'rules',
        component: Rules
      }
    }
  },
  '/preview': {
    name: 'preview',
    component: Preview
  }
})

router.redirect({
  '/': '/home/newest',
  '/home': '/home/newest',
  '/home/': '/home/newest'
})

router.start(App, '#app')

